﻿<!--#include file="h.asp"--><%
'
'	七色虎建站系统
'	会员修改资料页面
'	2011.11.2

Sub main
	checkLogin()'验证登录
	Dim a,userid,rs,sql,body_,userSex
	Dim remark,birth,sex,city
	Dim remark1,birth1,sex1
	Dim billMoney,billPoint,billExpr
	Dim userRegTime,timeInterval
	hu.title = "修改资料"
	body_ = "[div=nav]-"&hu.url("?aid=index","首页")&"-"&hu.url("bbs_user.asp","会员中心")&"-修改资料[/div]"
	a=getN("a", 0)
	userid=user_array(0)
	userSex=user_array(6)
	userRegTime=user_array(5)
	timeInterval = DateDiff("d", userRegTime, time_now)
	If a=0 Then
		sql = "select sex,remark,birthday from 74hu_user where id="&userid&""
		Set rs=hu.conn(sql)
		If Not rs.eof Then'其实可以不用这么做,但降低耦合
			If userSex<>"0" Then
				If timeInterval<31 Then body_ = body_ & "[div=tip]刚注册30天内修改免费[/div]"
			Else
				body_ = body_ & "[div=tip]首次修改资料可免费体验[/div]"
			End If
			sex=rs("sex")
			remark=nowml(rs("remark"))
			birth=rs("birthday")
			Dim formarray(4)
			formarray(0) = http_path&"bbs_data.asp?a=1||post||提交||性别："
			formarray(1) = "select||sex$$"&sex&"||1$$男||2$$女||<br/>签名：<br/>"
			formarray(2) = "input||remark$$"&remark&"$$20$$100||<br/>生日：<br/>"
			formarray(3) = "input||birth$$"&birth&"$$20||<br/>"
			formarray(4) = "hidden||"&bbsSid&"$$"&sid&"||sex1$$"&md5(userid&sex,16)&"||remark1$$"&md5(userid&remark,16)&"||birth1$$"&md5(userid&birth,16)&"||"
			body_ = body_ & hu.getForm(formarray) & "<br/>"&_
				"[div=tip]温馨提示:<br/>1、性别修改消费50"&bbsMoney&"<br/>2、生日修改消费50"&bbsMoney&"<br/>"&_
				"3、签名修改消费50"&bbsPoint&"[/div]"
		End If
		rs.close
		Set rs=Nothing
	Else
		sex1=getData("sex1")
		remark1=getData("remark1")
		birth1=getData("birth1")
		If sex1="" Or remark1="" Or birth1="" Then rupt "错误", "参数错误!"
		sex=getN("sex",1)
		remark=getD("remark","")
		birth=getD("birth","")
		If len(remark)>100 Then rupt "错误", "签名不能太长!"
		If birth="" Or IsDate(birth)=False Then rupt "错误", "生日格式不对,应如2008-8-8"
		If timeInterval >30 And userSex<>"0" Then 
			billMoney =0'账单,计算会员修改资料消费
			billPoint =0
			billExpr =0
			If md5(userid&sex,16)<>sex1 Then billMoney = billMoney -50
			If md5(userid&remark,16)<>remark1 Then billPoint = billPoint -50
			If md5(userid&birth,16)<>birth1 Then billMoney = billMoney -50
			Call setUserAmountBySelf(userid, billMoney&","&billPoint&","&billExpr)
		End If
		hu.conn("update 74hu_user set remark='"&remark&"',birthday='"&birth&"',sex="&sex&" where id="&userid)
		body_ = body_ & "修改成功!<br/>"&hu.url("bbs_user.asp","返回会员中心")
	End If
	hu.body = comUbb(body_)
End Sub

%>